<template>
    <div class="xuqiu">
        <div class="title">
            <span>加盟需求詢問</span>
            <a href="#/jiameng" class="more">更多</a>
        </div>
        <div class="main">
            <transition-group name="list" tag="p">
            <div class="main-item list-item"  v-for="(item,index) in list" :key="index">
                    <div class="icon"></div>
                <div class="right">
                    <div class="top">
                        {{item.name}} 地點：{{item.location}}
                    </div>
                    <div class="bottom">
                        預算：{{item.budget}}
                    </div>
                </div>
            </div>
            </transition-group>
        </div>
    </div>
</template>

<script>
    export default {
        name: "index-xuqiu",
        data() {
            return {
                list:[],
                timer:null
            }
        },
        mounted() {
            this.getApplyFranTop20();
        },
        methods:{
            getApplyFranTop20() {
                this.$http.post(this.API.get_apply_fran_top20).then((res) => {
                    let $this = this;
                if(res.status ===200 && res.data.length>0){
                    this.list = res.data.concat(res.data)
                    // this.getArr();
                }
            })
            },
            getArr() {
                this.timer = setInterval(() => {
                    let temp = this.list[this.list.length-1];
                    this.list.unshift(temp);
                },2000)
            }
        }
    }
</script>

<style scoped lang="less">
    .xuqiu{
        width: 100%;
        .title{
            height: 40px;
            background-color: #f4f4f4;
            font-size: 20px;
            color: #000000;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 0 12px;
            font-weight: bold;
            .more{
                font-size: 16px;
                color: #7d3e03;
                cursor: pointer;
            }
        }
        .main{
            background-color: #f9f9f9;
            width: 100%;
            max-height: 650px;
            overflow: hidden;
            border-right: 1px solid #e6e6e6;
            border-left: 1px solid #e6e6e6;
            border-bottom: 1px solid #e6e6e6;
            box-sizing: border-box;
            .main-item{
                box-sizing: border-box;
                height: 65px;
                padding: 0 12px;
                display: flex;
                flex-direction: row;
                align-items: center;
                border-bottom: 1px dashed #e6e6e6;
                cursor: pointer;
                &:hover{
                    box-shadow: 0 0 2px 2px #e6e6e6;
                }
                .bottom{
                    color: #c70b14;
                }
            }
            .icon{
                width: 60px;
                height: 45px;
                background-image: url("../../static/img/duihua.png");
                background-size: 100% 100%;
            }
        }
        .list-item {
            transition: all 1s;
            display: inline-block;
            margin-right: 10px;
        }
        .list-enter-active, .list-leave-active {
            transition: all 1s;
        }
        .list-enter, .list-leave-to
            /* .list-leave-active for below version 2.1.8 */ {
            opacity: 0;
            transform: translateY(-30px);
        }
    }

</style>